package com.spring.sunflower.userinfo

import com.spring.sunflower.base.BaseObserver
import com.spring.sunflower.base.BasePresenter
import com.spring.sunflower.bean.BlackHasBean
import com.spring.sunflower.bean.CheckApplyFaceVerifyBean
import com.spring.sunflower.bean.FaceAuthStatusBean
import com.spring.sunflower.common.CommonContract
import io.reactivex.rxjava3.core.Observable

/**
 * Created by Kevin on 2021/8/15<br/>
 *
 * Describe:<br/>
 */
class AuthCenterPresenter(baseView: CommonContract.AuthCenterView) :
    BasePresenter<CommonContract.AuthCenterView>(baseView) {
    fun getFaceAuthStatus() {
        val observable = requestDataSource.requestFaceAuthStatus()
        addDisposable(observable, object : BaseObserver<FaceAuthStatusBean>() {
            override fun onSuccess(bean: FaceAuthStatusBean) {
                baseView.showFaceAuthStatus(bean.datas)

            }

            override fun onError(status: Int, msg: String) {
            }
        })
    }

    fun getCheckFaceAuthStatus() {
        val observable = requestDataSource.requestCheckFaceAuthStatus()
        addDisposable(observable, object : BaseObserver<CheckApplyFaceVerifyBean>() {
            override fun onSuccess(bean: CheckApplyFaceVerifyBean) {
                baseView.showCheckFaceAuthStatus(bean.datas)
            }

            override fun onError(status: Int, msg: String) {
            }
        })
    }

    fun requestBeautyAuth() {
        val observable: Observable<BlackHasBean> =
            requestDataSource.beautyAuth()
        addDisposable(observable, object : BaseObserver<BlackHasBean>(baseView) {
            override fun onSuccess(bean: BlackHasBean?) {
                baseView.beautyAuthApplySuccess()
            }

            override fun onError(status: Int, msg: String) {
            }

        })
    }
}